package com.byxy.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name="ly_order")
public class LyOrder implements Serializable {

	@Id
	@GeneratedValue
	private Integer id;
	@Column(length=50)
	private String title;
	private Integer count;
	private Integer time;
	@Temporal(TemporalType.DATE)
	private Date startDate=new Date();
	@Temporal(TemporalType.DATE)
	private Date endDate=new Date();
	
	@Column(length=10)
	private String zt;
	@ManyToOne
	@JoinColumn(name="guideid",nullable=false)
	private LyGuide lyGuide;
	
	@ManyToOne
	@JoinColumn(name="lineid")
	private LyLine lyLine;
	
	@Column(length=50)
	private String remark;
	
	@ManyToOne
	@JoinColumn(name="agencyid")
	private LyAgency lyAgency;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public Integer getCount() {
		return count;
	}

	public void setCount(Integer count) {
		this.count = count;
	}

	public Integer getTime() {
		return time;
	}

	public void setTime(Integer time) {
		this.time = time;
	}

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public String getZt() {
		return zt;
	}

	public void setZt(String zt) {
		this.zt = zt;
	}

	public LyGuide getLyGuide() {
		return lyGuide;
	}

	public void setLyGuide(LyGuide lyGuide) {
		this.lyGuide = lyGuide;
	}

	public LyLine getLyLine() {
		return lyLine;
	}

	public void setLyLine(LyLine lyLine) {
		this.lyLine = lyLine;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public LyAgency getLyAgency() {
		return lyAgency;
	}

	public void setLyAgency(LyAgency lyAgency) {
		this.lyAgency = lyAgency;
	}

	public LyOrder(Integer id, String title, Integer count, Integer time, Date startDate, Date endDate, String zt,
			LyGuide lyGuide, LyLine lyLine, String remark, LyAgency lyAgency) {
		super();
		this.id = id;
		this.title = title;
		this.count = count;
		this.time = time;
		this.startDate = startDate;
		this.endDate = endDate;
		this.zt = zt;
		this.lyGuide = lyGuide;
		this.lyLine = lyLine;
		this.remark = remark;
		this.lyAgency = lyAgency;
	}

	public LyOrder() {
		super();
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((count == null) ? 0 : count.hashCode());
		result = prime * result + ((endDate == null) ? 0 : endDate.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((lyAgency == null) ? 0 : lyAgency.hashCode());
		result = prime * result + ((lyGuide == null) ? 0 : lyGuide.hashCode());
		result = prime * result + ((lyLine == null) ? 0 : lyLine.hashCode());
		result = prime * result + ((remark == null) ? 0 : remark.hashCode());
		result = prime * result + ((startDate == null) ? 0 : startDate.hashCode());
		result = prime * result + ((time == null) ? 0 : time.hashCode());
		result = prime * result + ((title == null) ? 0 : title.hashCode());
		result = prime * result + ((zt == null) ? 0 : zt.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		LyOrder other = (LyOrder) obj;
		if (count == null) {
			if (other.count != null)
				return false;
		} else if (!count.equals(other.count))
			return false;
		if (endDate == null) {
			if (other.endDate != null)
				return false;
		} else if (!endDate.equals(other.endDate))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (lyAgency == null) {
			if (other.lyAgency != null)
				return false;
		} else if (!lyAgency.equals(other.lyAgency))
			return false;
		if (lyGuide == null) {
			if (other.lyGuide != null)
				return false;
		} else if (!lyGuide.equals(other.lyGuide))
			return false;
		if (lyLine == null) {
			if (other.lyLine != null)
				return false;
		} else if (!lyLine.equals(other.lyLine))
			return false;
		if (remark == null) {
			if (other.remark != null)
				return false;
		} else if (!remark.equals(other.remark))
			return false;
		if (startDate == null) {
			if (other.startDate != null)
				return false;
		} else if (!startDate.equals(other.startDate))
			return false;
		if (time == null) {
			if (other.time != null)
				return false;
		} else if (!time.equals(other.time))
			return false;
		if (title == null) {
			if (other.title != null)
				return false;
		} else if (!title.equals(other.title))
			return false;
		if (zt == null) {
			if (other.zt != null)
				return false;
		} else if (!zt.equals(other.zt))
			return false;
		return true;
	}
	
	
	
}

